import java.util.ArrayList;
import java.util.List;

class Fruit {
}

class Apple extends Fruit {
}

class Apple1 extends Apple {
}

class Orange extends Fruit {
}

public class TestGeneric<T> {

    public static void main(String[] args) {

    }

    public void testExtends(){
        List<? extends Fruit> list = new ArrayList<>();
        //list.add(new Apple());
        //list.add(new Orange());
        //list.add(new Fruit());
        list.add(null);

        list.contains(new Apple());
        list.indexOf(new Apple());

        //Apple apple = list.get(0);
    }

    public void testSuper(){
        List<? extends Apple> list = new ArrayList<>();
        //list.add(new Apple());
        //list.add(new Apple1());
        //list.add(new Fruit());

        Object apple = list.get(0);
    }
}